<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if (window.top !== window.self) { window.top.location = window.location; }</script>
</head>

<body class="gray-bg">

    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>

                <h1 class="logo-name">Dt</h1>

            </div>
            <h3>欢迎使用 DtAdmin</h3>

            <form class="m-t" role="form" action="index.html">
                <div class="form-group">
                    <input type="email" class="form-control" placeholder="用户名" required="" id="username">
                </div>
                <div class="form-group">
                    <input type="password" class="form-control" placeholder="密码" required="" id="password">
                </div>
                <button type="button" class="btn btn-primary block full-width m-b" onclick="login()">登 录</button>

                <p class="text-muted text-center"> <a href="restpassword.html"><small>重置密码?</small></a> | <a onclick="regiter()">其实这里什么都没有</a>
                </p>

            </form>
        </div>
    </div>

    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>
    <script type="text/javascript"  src="js/host.js"></script>

    <script>
        var click = 0;
        function regiter(){
            click += 1;
            var r = parseInt(Math.random()*12,10)+1;
            var arr = ["","不要点了好不好","真的什么也没有","有没有意思","你是不是很无聊","干嘛要点我","你是要疯吗,点我","点那么多次你不累吗","大力点击有惊喜",
            "老铁双击666","你原来就是盗圣,怪不得那么会点","你点破鼠标也不会有人理你的","你点的越大声我越兴奋","使劲点"]
            var str = arr[r];
            if(click==20){
                while(true){
                    alert("给你说了不要点,烦不烦");
                }
            }
            alert(str);
        }

        function login() {
            var username = $("#username").val();
            var password = $("#password").val();
            $.ajax({
                type: "POST",
                url: localhost+"/userManage/userLogin",
                data: '{ "user_name": "' + username + '", "user_passwd": "' + password + '"}',
                xhrFields: {
                    withCredentials: true
                },
                dataType: "json",
                success: function (data) {
                    if (data["response_msg"] == "success") {
                        alert("登录成功");
                        window.location.href = "index-n.html";
                    } else {
                        alert("登录失败:" + data["response_msg"]);
                        window.location.href = "login.html";
                    }
                },
                error: function (data) {
                    alert("登录失败");
                    //window.location.href="login.html";
                }
            });
        }
    </script>



</body>

</html>